package com.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.RepairquotationMapper;
import com.pojo.Repairquotation;
import com.service.PayService;
import com.service.RepairQuotationService;
import com.vo.LineVo;
import com.vo.RepairquotationVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("repairQuotationService")
public class RepairQuotationServiceImpl implements RepairQuotationService {
    @Resource
    private RepairquotationMapper repairquotationMapper;
    @Resource
    private PayService payService;
    @Override
    public int addQuotation(RepairquotationVo repairquotationVo) {
        int insert = repairquotationMapper.addRepairQuotation(repairquotationVo);
        return insert;
    }

    @Override
    public PageInfo<Repairquotation> OwnerSelect(RepairquotationVo repairquotationVo, Integer ownerid) {
        PageHelper.startPage(repairquotationVo.getPage(),repairquotationVo.getLimit());
        repairquotationVo.setOwnerid(ownerid);
        List<Repairquotation> repairquotations = repairquotationMapper.OwnerSelectQuotation(repairquotationVo);
        PageInfo<Repairquotation> pageInfo=new PageInfo<>(repairquotations);
        return pageInfo;
    }

    @Override
    public int OwnerUpdateQuotationState(Integer id) {
        int i = repairquotationMapper.OwnerUpdateQuotationState(id);
        return i;
    }

    @Override
    public List<LineVo> selectallrepairquotation() {
        List<LineVo> selectallrepairquotation = repairquotationMapper.selectallrepairquotation();
        return selectallrepairquotation;
    }


}
